import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class DatabaseTests {
	private Database db;
	private TraderInfo [] traders;
	private Offer [] offers;
	
	@Before
	public void setUp() throws Exception{
		db = new Database();
		traders = new TraderInfo[3];
		traders[0] = new TraderInfo("Mark", 200);
		traders[0].addOre("Gold", 1000);
		traders[0].addOre("Tin", 500);
		
		traders[1] = new TraderInfo("Rene", 1000000);
		
		traders[2] = new TraderInfo("David", 0);
		traders[2].addOre("Iron", 10000);
		traders[2].addOre("Gold", 500);	
		
		offers = new Offer[3];
		//offers[0] = 
	}
	
	@Test 
	public void testContainsTrader(){
		assertTrue(db.containsTrader("Mark"));
		assertFalse(db.containsTrader(""));
		assertFalse(db.containsTrader("Billy"));
	}
	
	@Test
	public void testGetTrader(){
		TraderInfo mark = db.getTrader("Mark");
		assertTrue(mark.traderID.compareTo("Mark") == 0);
		assertTrue(mark.fundsAvailable == 1000);
		assertTrue(mark.hasOre("Gold") == 1000);
		assertFalse(mark.hasOre("Nickel") == 0);
		
	}
	
	
	

}
